#pragma once
//SRM304DIV2_500
//SRM304DIV1_250
//2009/10/23 16:29:41
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

class MovingAvg
{
public:
	double difference(int k, vector <double> data)
	{
		double min = -1.0;
		double max = -1.0;
		for(int i=0; i+k<=data.size(); i++)
		{
			double sum = .0;
			for(int j=i; j<i+k; j++)
				sum += data[j];
			sum /= k;
			cout << sum << endl;
			if(min > sum || min == -1.0) min = sum;
			if(max < sum || max == -1.0) max = sum;
		}
		return max - min;
	}
};
